import {
  HTTP
} from '../utils/http'
import mpx from '@mpxjs/core'
import apiProxy from '@mpxjs/api-proxy'

mpx.use(apiProxy, {
  usePromise: true
})

class TaskModel extends HTTP {
  // 获取我的任务列表
  async getTaskList(data = {}) {
    const res = await this.request({
      url: '/sea/api/1.0/client/v1/xinshui/my/jobList',
      data
    })
    return res
  }

  // 领取任务
  async claimTask(data = {}) {
    const res = await this.request({
      url: '/sea/api/1.0/client/v1/xinshui/job/draw',
      data
    })
    return res
  }

  // 任务详情
  async getTaskDetail(data = {}) {
    const res = await this.request({
      url: '/sea/api/1.0/client/v1/xinshui/job/detail',
      data
    })
    return res
  }

  // 获取任务步骤
  async getTaskStep(data = {}) {
    const res = await this.request({
      url: '/sea/api/1.0/client/v1/xinshui/contract/checkV3',
      data
    })
    return res
  }

  // 获取任务内容
  async getContractContent(data = {}) {
    const res = await this.request({
      url: '/sea/api/1.0/client/v1/xinshui/contract/templateV3',
      data
    })
    return res
  }

  // 校验
  async checkCondition(data = {}) {
    const res = await this.request({
      url: '/sea/api/1.0/client/v1/xinshui/contract/checkCondition',
      data
    })
    return res
  }

  // 提交
  async getMyworkInfo(data) {
    const res = await this.request({
      url: '/sea/api/1.0/client/v1/project/get/mywork',
      data
    })
    return res
  }
}

export {
  TaskModel
}
